<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>呼叫云</title>
    <link rel="shortcut icon" href="../img/logox_circle.png">
    <link rel="stylesheet" href="../css/pintuer.css">
    <link rel="stylesheet" href="../css/admin.css">
    <script src="../js/jquery-1.11.0.min.js"></script> 
    <script src="../js/config.js"></script>
    <script src="../js/fenye.js"></script> 
    <script src="../common/laydate/laydate.js"></script> 
	<script>
		$(function(){
			$("#showName").val("cloud2");
			//总条数
			var counts = ${count};
			//总页数
			var pageCouts = "";
			if(counts % 10 == 0){
				pageCouts =  parseInt(counts/10);
			}else{
				pageCouts =  parseInt(counts/10) + 1;
			}
			pg = new showPages('pg','${page}',pageCouts,counts);
			
			pg.printHtml(2,pageCouts);        //显示页数
			
			showPages.prototype.createUrl = function (page) { //生成页面跳转url
				if (isNaN(parseInt(page))) page = 1;
				if (page < 1) page = 1;
				if (page > this.pageCount) page = this.pageCount;
				var url = location.protocol + '//' + location.host + location.pathname +"?page="+page;
				
				//获取参数
				var companyLoginName = $("#companyLoginName").val();
				if(companyLoginName != ""){
					url = url+"&companyLoginName="+companyLoginName;
				}
				
				var taskName = $("#taskName").val();
				if(taskName != ""){
					url = url+"&taskName="+taskName;
				}
				
				var createloginName = $("#createloginName").val();
				if(createloginName != ""){
					url = url+"&createloginName="+createloginName;
				}
				
				var isSuccess = $("#isSuccess").val();
				if(isSuccess != ""){
					url = url+"&isSuccess="+isSuccess;
				}
				
				var startTime = $("#startTime").val();
				var enTime = $("#enTime").val();
				if(startTime != "" && enTime != ""){
					url = url+"&startTime="+startTime+"&enTime="+enTime;
				}
				
				return url;
			}
			
		});
		//查看详情
		function getWorkorder(workOrderID){
			var url = window.location.search;
			if(url != ""){
				location.href=serviceConfig.business.getWorkorder+"?workOrderID="+workOrderID+"&url="+escape(url);
			}else{
				location.href=serviceConfig.business.getWorkorder+"?workOrderID="+workOrderID;
			}
		}
		//搜索
		function search(){
			var startTime = $("#startTime").val();
			var enTime = $("#enTime").val();
			if(startTime != ""){
				if(enTime == ""){
					alert("截止日期不能为空！");
				}else{
					$("#getWorkorderList").submit();
				}
			}else{
				$("#getWorkorderList").submit();
			}
		}
		//解冻
		function thawWorkorder(workOrderID,title){
			var message="确定要解冻"+title+"吗？";
			 if(confirm(message)){
				var isSuccess = "1";
				$.ajax({
					 url:serviceConfig.business.updateWorkorderIsSuccess,
					 type: "get",
			         data:{
			         	workOrderID:workOrderID,
			         	isSuccess:isSuccess
			         },
			         dataType: "json",
			         success:function(data){
			        	 if(data.flag == 1){
			        	 	window.location.reload();//刷新当前页面.
			        	 }else if(data.flag == 0){
			        	 	alert("参数错误");
			        	 }
			         },
			         error:function(data){
			        	 console.log(data);
			         }
				});
			}
		}
	</script>
</head>

<body>
<div class="lefter">
    <div class="logo"><a href="#" target="_blank"><img style="width:100%;" src="../img/logo3.png" alt="呼叫云后台管理系统" /></a></div>
</div>
<div class="righter nav-navicon" id="admin-nav">
    <div class="mainer">
        <div class="admin-navbar">
            <span class="float-right">
            	<span id="user_name"></span>
                <a class="button button-little bg-yellow" href="login">注销登录</a>
            </span>
            <#include "../common/head.ftl"> 
        </div>
        <div class="admin-bread">
            <ul class="bread">
                <li><a class="icon-cloud"> 业务管理</a></li>
                <li><a >通话管理</a></li>
            </ul>
        </div>
    </div>
</div>
<div class="admin">
    <div class="line-big">
		<div class="xm12">
			<form action="getWorkorderList" id="getWorkorderList" method="get">
			<div style="float:left;padding-top:5px;"><strong>企业用户：</strong></div>
			<div style="float:left;">
				<input type="text" class="input" style="width:80%;" id="companyLoginName" name="companyLoginName" value="${companyLoginName}">
			</div>
			<div style="float:left;padding-top:5px;"><strong>任务名称：</strong></div>
			<div style="float:left;">
				<input type="text" class="input" style="width:80%;" id="taskName" name="taskName" value="${taskName}">
			</div>
			<div style="float:left;padding-top:5px;"><strong>客服用户：</strong></div>
			<div style="float:left;">
				<input type="text" class="input" style="width:80%;" id="createloginName" name="createloginName" value="${createloginName}">
			</div>
			<div style="float:left;padding-top:5px;"><strong>成单状态：</strong></div>
			<div style="float:left;">
				<select class="input" id="isSuccess" style="width:120%;" name="isSuccess">
					<option value="" >请选择成单状态</option>
					<option value="0" <#if isSuccess=='0' > selected </#if>>未成单</option>
					<option value="1" <#if isSuccess=='1' > selected </#if>>待确认</option>
					<option value="2" <#if isSuccess=='2' > selected </#if>>确认成单</option>
					<option value="3" <#if isSuccess=='3' > selected </#if>>已冻结</option>
				</select>
			</div>
			<br/><br/>
			<div style="float:left;padding-top:20px;"><strong>创建时间：</strong></div>
			<div style="float:left;padding-top:15px;">
				<input onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm'})" placeholder="开始时间" style="width:95%;" class="input" id="startTime" name="startTime" value="${startTime}">
			</div>
			<div style="float:left;padding-top:20px;">
				<strong>-&nbsp;</strong>
			</div>
			<div style="float:left;padding-top:15px;padding-left:5px;">
				<input onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm'})" placeholder="截止时间" style="width:95%;" class="input" id="enTime" name="enTime" value="${enTime}">
			</div>
			</form>
			<div style="float:left;padding-top:15px;padding-left:20px;">
				<button class="button bg-main" onclick="search()" type="submit">搜索</button>
			</div>
		</div>
	</div>
    <div class="panel admin-panel" style="margin-top:20px;">
		
    	<div class="panel-head"><strong>通话记录列表</strong></div>
        
        <table class="table table-hover">
        	<tr>
				<th width="40">序号</th>
				<th width="80">企业用户</th>
				<th width="80">企业名称</th>
				<th width="120">任务名称</th>
				<th width="80">客服用户</th>
				<th width="80">客服姓名</th>
				<th width="100">工单标题</th>
				<th width="120">工单描述</th>
				<th width="80">成单状态</th>
				<th width="120">冻结原因</th>
				<th width="100">客户姓名</th>
				<th width="100">客户手机号</th>
				<th width="120">跟进时间</th>
				<th width="120">成单时间</th>
				<th width="120">创建时间</th>
				<th width="120">修改时间</th>
				<th width="120">操作</th>
			</tr>
			<#list workorderList as workorderMap>
				<#if count gt 0 >
				<tr>
					<td>${workorderMap_index+1}</td>
						<td>${workorderMap.companyLoginName}</td>
					    <td>${workorderMap.companyName}</td>
					    <td>${workorderMap.taskName}</td>
					    <td>${workorderMap.createloginName}</td>
					    <td>${workorderMap.createName}</td>
					    <td>${workorderMap.title}</td>
					    <td>${workorderMap.desc}</td>
					    <td>
					    	<#if workorderMap.isSuccess == 0>
					    	未成单
					    	<#elseif workorderMap.isSuccess == 1>
					    	待确认
					    	<#elseif workorderMap.isSuccess == 2>
					    	成单确认
					    	<#elseif workorderMap.isSuccess == 3>
					    	已冻结
					    	</#if>
					    </td>
					    <td>${workorderMap.freezeReason}</td>
					    <td>${workorderMap.customerName}</td>
					    <td>${workorderMap.customerPhone}</td>
					    <td>${workorderMap.followTime}</td>
					    <td>${workorderMap.completeTime}</td>
					    <td>${workorderMap.createTime}</td>
					    <td>${workorderMap.updateTime}</td>
						<td>
							<a class="button border-blue button-little" href="#" onclick="getWorkorder('${workorderMap.workOrderID}')">查看</a>
							<#if workorderMap.isSuccess == 3>
						    	<a class="button border-yellow button-little" href="#" onclick="thawWorkorder('${workorderMap.workOrderID}','${workorderMap.title}')">解冻</a>
					    	</#if>
						</td>
				</tr>
				</#if>
			</#list>
			
        </table>
        <div class="panel-foot text-center">
				<#if count gt 0 >
		            <!--<ul class="pagination"><li><a href="#">上一页</a></li></ul>
		            <ul class="pagination pagination-group">
		                <li class="active"><a href="#">1</a></li>
		                <li><a href="#">2</a></li>
		                <li><a href="#">3</a></li>
		                <li><a href="#">4</a></li>
		                <li><a href="#">5</a></li>
		            </ul>
		            <ul class="pagination"><li><a href="#">下一页</a></li></ul>-->
		            
		            
		             <div class="page" id="pages"></div>
		            
		            
		        <#else>
		       <div style="padding-top:30px;"><strong>没有相关数据</strong></div>
				</#if>
        </div>
    </div>
    <br />
</div>

</body>
</html>